package com.xk.sport.backend.dao.repository;

import com.xk.sport.backend.dao.model.Lesson;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface LessonDao extends JpaRepository<Lesson, Long>, JpaSpecificationExecutor<Lesson> {
    @Query(value = "select * from lesson where id in (?1)", nativeQuery = true)
    List<Lesson> findLessonsByIds(List<Long> ids);

    @Query(value = "select id from lesson where name like %?1%", nativeQuery = true)
    Long[] findIdsByName(String name);
}
